<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<script type="text/javascript" src="<%= request.getContextPath() %>/js/admin.js"></script>
</head>
 
<body>
<fieldset>
	<legend>Tài khoản</legend>
	<s:actionmessage/>
	<s:form action="updateAccount" onsubmit="return validateAccount();">
	<s:hidden name="addNew" value="true"></s:hidden>
		<table>
			<tr>
				<td>Tên đăng nhập*:</td>
				<td><s:textfield name="username" id="username" /></td>
			</tr>
			<tr>
				<td>Mật khẩu*:</td>
				<td><s:password name="password" id="password" /></td>
			</tr>
			<tr>
				<td>Nhập lại mật khẩu*:</td>
				<td><s:password name="rePassword" id="rePassword" /></td>
			</tr>
			<tr>
				<td>Họ tên*:</td>
				<td><s:textfield name="name" id="name" /></td>
			</tr>
			<tr>
				<td>Tuổi:</td>
				<td><s:textfield name="age" id="age" maxlength="3" /></td>
			</tr>
			<tr>
				<td>Chức vụ:</td>
				<td><s:textfield name="title" id="title" /></td>
			</tr>
			<tr>
				<td>Quyền*:</td>
				<td><s:select list="roleList" listKey="roleId" listValue="name" label="" name="role" /></td>
			</tr>
			<tr>
				<td></td>
				<td><input type="submit" value="Thêm mới" /></td>
			</tr>
		</table>
	</s:form>
</fieldset>
<br/>
<table id="searchResult">
<thead>
	<tr>
		<td>Tên đăng nhập</td>
		<td>Họ tên</td>
		<td>Tuổi</td>
		<td>Chức vụ</td>
		<td>Sửa</td>
		<td>Xóa</td>
	</tr>
</thead>
<tbody>
<s:iterator value="results" status="result">
	<tr>
		<td><s:property value="username" /></td>
		<td><s:property value="name" /></td>
		<td><s:property value="age" /></td>
		<td><s:property value="title" /></td>
		<td><a href="editAccount.action?username=<s:property value="username" />"><img src="<%= request.getContextPath() %>/images/edit.png" /></a></td>
		<td><a href="deleteAccount.action?username=<s:property value="username" />" onclick="return confirm('Bạn muốn xóa người này?')"><img src="<%= request.getContextPath() %>/images/delete.png" /></a></td>
	</tr>
</s:iterator>
</tbody>
</table>
</body>
</html>